import numpy as np
import sys
import os

def read_floats_with_numpy(filename):
    # 直接读取为float32数组
    float_array = np.fromfile(filename, dtype=np.float32)
    return float_array

# 使用示例
gt_file_name = os.path.realpath(sys.argv[1])
tg_file_name = os.path.realpath(sys.argv[2])
gt_floats = read_floats_with_numpy(gt_file_name)
tg_floats = read_floats_with_numpy(tg_file_name)

diff = tg_floats-gt_floats

print(f"  min {np.min(diff)}  \n  max {np.max(diff)}  \n  median {np.median(diff)}  \n  mean {np.mean(np.abs(diff))}  ")

print(diff)